#include "Mandelbrot.h"

using namespace std;


void test1(){}

void test2(){}

void test3(){}


int main(int argc, char *argv[]) {
	cout << "ancho =" << (1<<WIDTH) << endl;
	long long int lala = 0xff000000;
	long int p = 0x001100;
	lala += p;
	cout << "numero loco : :  << " << hex << lala << endl;

	Video video = *(new Video(1<<WIDTH,1<<HEIGHT));
	int* matriz = video.matriz();
    Mandelbrot mandela(matriz);
    Float a("-2,0");
    Float b("2,0");
	Complex z(a,a);
	Complex w(b,b);
//	Complex z(-2,-2);
//	Complex w(-1,-1);
	cout << "Z: " << z << endl;
	cout << "W: " << w << endl;
	mandela.genera(z,w);
	video.refresh();	
	cout << "terminé principal" << endl;

	int pos[2] = {0,0};	

	while( true ){
		cout << "entro..." << endl;
		video.waitForClick(pos);
		if( pos[0] == -1 || pos[1] == -1)		
			break; // se muere con el escape ahora bien		
		//cout << "salió" << endl;
		//cout << "X: " << pos[0] << " Y: " << pos[1] << endl;
		//cout << "X: " << (long double)pos[0]*4/512 << " Y: " <<(long double) pos[1]*4/512 << endl;
		//mandela.genera(pos[0],pos[1]);
		cout << "llamado a la tupla: " << pos[0] << "/" << pos[1] << endl;
		mandela.genera(pos[0],pos[1]);
		video.refresh();
		cout << "dibujé algo?" << endl;
	}
	
	cout << "parachuteandooooo.... ojojojo" << endl;

/*	long double x1 = -2;
        long double x2 = 2;
        long double y1 = -2;
        long double y2 = 2;
        hacerFractal(matriz,-2,2,-2,2);
        video.refresh();
        int pos[2];
        video.waitForClick(pos);
        while(true) {
//              cout << "X: " << pos[0] << " Y: " << pos[1] << endl;
                x1 = x1 + ((long double)pos[0]*(x2-x1)/512);
                y1 = y1 + ((long double)pos[1]*(x2-x1)/512);
	        x1-=2;
                y1-=2;
                x2=x1+4;
                y2=y1+4;
//              cout << "EN EL PLANO X: " << x1 << endl;
                if(pos[0] <= 10)
                        break;
                cout << "DIBUJANDO" << endl;
                hacerFractal(matriz,x1,x2,y1,y2);
                cout << "FIN" << endl;
                video.refresh();
                video.waitForClick(pos);
        }
        PyRun_SimpleString ("time.sleep(5)");
        return 0;
}

*/


	//RUNTEST(test1, );
	//RUNTEST(test2, );
	//RUNTEST(test3, );
	return 0;
	
}
